#ifndef __HIK_CAMERA_H__
#define __HIK_CAMERA_H__

#include <iostream>
#include <unordered_map>
#include "HCNetSDK.h"

class HikCamera{
public:
    HikCamera();
    HikCamera(std::string ip, int port=8000, std::string pwd="scdx1234", std::string user="admin");

    bool setIp(std::string _ip);
    bool setPort(int _port);
    bool setPWD(std::string _pwd);
    bool setUser(std::string _user);

    bool capture();
    bool check();
    bool control();

    bool start();
    bool pause();

    bool getCFG();

    bool setParams(std::string k, int value);

    bool setCFG();

    bool init();

    bool getInfo();

    ~HikCamera();
private:
    long lUserID;
    std::string ip;
    int port;
    std::string pwd;
    std::string user;

    long handle;
    int nPort;

    bool initOK;
    
    std::unordered_map<std::string, int> outParamsMap{{"dwStreamType",0}, //主码流
    {"byResolution",70}, //分辨率
    {"byStreamType",0}, //视频流
    {"byBitrateType",1}, //定码率
    {"dwVideoBitrate",24}, //码率上限
    {"dwVideoFrameRate",13}, //帧率
    {"wIntervalFrameI",20}, //i帧间隔
    {"byVideoEncType",10}, //编码格式
    {"byStreamSmooth",50}};//平滑系数

    NET_DVR_USER_LOGIN_INFO struLoginInfo{0};
    NET_DVR_DEVICEINFO_V40 struDeviceInfoV40{0};

    NET_DVR_MULTI_STREAM_COMPRESSIONCFG_COND lpInBuffer{0};
    WORD status{0};
    NET_DVR_MULTI_STREAM_COMPRESSIONCFG lpInParamBuffer{0};

};

#endif